{% extends "base_generic.html" %}
{% block script %}
<script type="text/javascript">
function generateUrl(name) {
  var sanitizedName = string_to_slug(name);
  $("#url").val(sanitizedName);
}
</script>
{% endblock %}
{% block content %}
	<h1>Term</h1>
<form name="edit-admin" id="edit-admin" method="post" action="{{path}}">
<div class="field">
<label for="word">Word:</label>
<input type="text" name="word" id="word" value="{{term.word}}" onblur="generateUrl($('#word').val())" />
</div>
<div class="field">
<label for="name">Translate:</label>
<input type="text" name="translate" id="translate" value="{{term.translate}}" />
</div>
<input type="hidden" name="url" id="url" value="{{term.url}}" />
<div class="field">
<label for="genre">Language:</label>
{% for alanguage in languages %}
{% if forloop.first %}
<select name="language" id="language">
{% endif %}
<option value="{{alanguage.key}}" {% ifequal alanguage.url language %}selected="selected"{% endifequal %}>{{alanguage.name}}</option>
{% if forloop.last %}
</select>
{% endif %}
{% endfor %}
</div>
<div class="field">
<label for="termtype">Term type:</label>
{% for atermtype in termtypes %}
{% if forloop.first %}
<select name="termtype" id="termtype">
{% endif %}
<option value="{{atermtype.key}}" {% ifequal atermtype.url termtype %}selected="selected"{% endifequal %}>{{atermtype.name}}</option>
{% if forloop.last %}
</select>
{% endif %}
{% endfor %}
</div>
<input type="submit" name="save" class="mainbutton" id="publish" value="Save" />
<br class="clear" />
</form>
{% endblock %}
